<template>
  <div id="GGJSJ">
    <p style="text-align: center; margin: 10px 0">扣件式钢管脚手架检查验收表</p>
    <table border="1" width="100%">
      <tr>
        <td colspan="5">房屋验收层数</td>
        <td colspan="3">{{number}}</td>
      </tr>
      <tr>
        <th colspan="5">验收内容</th>
        <th rowspan="2">技术要求</th>
        <th rowspan="2">允许偏差Δ（mm）</th>
        <th rowspan="2">检查结果</th>
      </tr>
      <tr>
        <th>项次</th>
        <th colspan="4">项目</th>
      </tr>

      <tr>
        <td rowspan="11">1</td>
        <td rowspan="11" colspan="2">材料</td>
        <td rowspan="6" colspan="2">钢管</td>
        <td>产品合格证（新管应有）；</td>
        <td>—</td>
        <td rowspan="6">
          <van-radio-group v-model="form.GGYS">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
          <!--<van-field v-model="form.GGYS" placeholder="" />-->
        </td>
      </tr>
      <tr>
        <td>表面平直光滑、不应有裂纹、分层、压痕、划道和硬弯；</td>
        <td>—</td>
        <td></td>
      </tr>
      <tr>
        <td>划道和硬弯；</td>
        <td>—</td>
        <td></td>
      </tr>
      <tr>
        <td>外径48.3mm</td>
        <td>±0.5</td>
        <td></td>
      </tr>
      <tr>
        <td>壁厚3.6mm</td>
        <td>±0.36</td>
        <td></td>
      </tr>
      <tr>
        <td>外表面锈蚀深度</td>
        <td>≤0.18</td>
        <td></td>
      </tr>

      <tr>
        <td rowspan="1" colspan="2">扣件</td>
        <td>产品合格证（新扣件应有）；不得有裂缝、变形，螺栓不得滑丝</td>
        <td>—</td>
        <td>
          <van-radio-group v-model="form.KJYS">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
          <!--<van-field v-model="form.KJYS" placeholder="" />-->
        </td>
      </tr>

      <tr>
        <td rowspan="4" colspan="2">钢管弯曲</td>
        <td>各杆件端部弯曲L≤1.5m</td>
        <td>≤5</td>
        <td>
          <van-radio-group v-model="form.GGWQYS1">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
          <!--<van-field v-model="form.GGWQYS1" placeholder="" />-->
        </td>
      </tr>
      <tr>
        <td>立杆弯曲3m&lt;L≤4m</td>
        <td>≤12</td>
        <td rowspan="2">
          <van-radio-group v-model="form.GGWQYS2">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
          <!--<van-field v-model="form.GGWQYS2" placeholder="" />-->
        </td>
      </tr>
      <tr>
        <td>立杆弯曲4m&lt;L≤6.5m</td>
        <td>≤20</td>
        <!-- <td>
        </td>-->
      </tr>
      <tr>
        <td>水平杆、斜杆弯曲L≤6.5m</td>
        <td>≤30</td>
        <td>
          <!--<van-field v-model="form.GGWQYS3" placeholder="" />-->
          <van-radio-group v-model="form.GGWQYS3">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
        </td>
      </tr>

      <tr>
        <td rowspan="3">2</td>
        <td rowspan="3" colspan="2">基底</td>
        <td rowspan="1" colspan="2">表面</td>
        <td>坚实平整</td>
        <td>—</td>
        <td>
          <!--<van-field v-model="form.BMYS" placeholder="" />-->
          <van-radio-group v-model="form.BMYS">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
        </td>
      </tr>
      <tr>
        <td rowspan="1" colspan="2">排水</td>
        <td>不积水</td>
        <td>—</td>
        <td>
          <van-radio-group v-model="form.PSYS">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
          <!--<van-field v-model="form.PSYS" placeholder="" />-->
        </td>
      </tr>
      <tr>
        <td rowspan="1" colspan="2">垫板</td>
        <td>不松动</td>
        <td>—</td>
        <td>
          <!--<van-field v-model="form.DBYS" placeholder="" />-->
          <van-radio-group v-model="form.DBYS">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
        </td>
      </tr>

      <tr>
        <td rowspan="6">3</td>
        <td rowspan="6" colspan="2">杆件连接</td>
        <td rowspan="1" colspan="2">立杆</td>
        <td>除顶层顶步外均应对接，搭接长度≥1m；不少于2个旋转扣件；端部扣件盖板边缘至杆端距离≥0.1m；</td>
        <td>0</td>
        <td>
          <!--<van-field v-model="form.LGYS" placeholder="" />-->
          <van-radio-group v-model="form.LGYS">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
        </td>
      </tr>
      <tr>
        <td rowspan="1" colspan="2">纵向水平杆</td>
        <td>可对接或搭接，搭接时：搭接长度≥1m；等间距设置3个旋转扣件；端部扣件盖板边缘至杆端距离≥0.1m</td>
        <td>0</td>
        <td>
          <!--<van-field v-model="form.ZXSPGYS" placeholder="" />-->
          <van-radio-group v-model="form.ZXSPGYS">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
        </td>
      </tr>
      <tr>
        <td rowspan="1" colspan="2">横向水平杆</td>
        <td>两端伸出立杆净长度不小于0.1m</td>
        <td>0</td>
        <td>
          <!--<van-field v-model="form.HXSPGYS" placeholder="" />-->
          <van-radio-group v-model="form.HXSPGYS">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
        </td>
      </tr>
      <tr>
        <td rowspan="1" colspan="2">剪刀撑</td>
        <td>搭接长度不小于1m，不少于3个旋转扣件固定</td>
        <td>0</td>
        <td>
          <!--<van-field v-model="form.GJJDCYS" placeholder="" />-->
          <van-radio-group v-model="form.GJJDCYS">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
        </td>
      </tr>
      <tr>
        <td rowspan="1" colspan="2">接头位置</td>
        <td>
          不应设置在同步或同距内，不同步或不同跨两个相邻接长在竖向或水平方向错开的距离不小于500mm
          各接头中心至最近主节点的距离不大于步距或纵距的1/3
        </td>
        <td>0</td>
        <td>
          <!--<van-field v-model="form.JTWZYS" placeholder="" />-->
          <van-radio-group v-model="form.JTWZYS">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
        </td>
      </tr>
      <tr>
        <td rowspan="1" colspan="2">扣件扭力矩</td>
        <td>应在40N.m〜65N.m间</td>
        <td>0</td>
        <td>
          <!--<van-field v-model="form.NJNLJYS" placeholder="" />-->
          <van-radio-group v-model="form.NJNLJYS">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
        </td>
      </tr>

      <tr>
        <td rowspan="3">4</td>
        <td rowspan="3" colspan="2">连墙件</td>
        <td rowspan="1" colspan="2">设置间距</td>
        <td>二步三跨或三步三跨</td>
        <td>—</td>
        <td>
          <!--<van-field v-model="form.SZJJYS" placeholder="" />-->
          <van-radio-group v-model="form.SZJJYS">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
        </td>
      </tr>
      <tr>
        <td rowspan="1" colspan="2">离主节点距离</td>
        <td>≤300mm</td>
        <td>0</td>
        <td>
          <!--<van-field v-model="form.LZJDJLYS" placeholder="" />-->
          <van-radio-group v-model="form.LZJDJLYS">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
        </td>
      </tr>
      <tr>
        <td rowspan="1" colspan="2">与建筑物连接</td>
        <td>刚性连接，牢固</td>
        <td>—</td>
        <td>
          <!--<van-field v-model="form.JZWLJYS" placeholder="" />-->
          <van-radio-group v-model="form.JZWLJYS">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
        </td>
      </tr>

      <tr>
        <td rowspan="1">5</td>
        <td rowspan="1" colspan="2">扫地杆</td>
        <td rowspan="1" colspan="2">—</td>
        <td>纵向扫地杆离钢管底端不大于200mm，纵在上横在下</td>
        <td>0</td>
        <td>
          <!--<van-field v-model="form.SDGYS" placeholder="" />-->
          <van-radio-group v-model="form.SDGYS">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
        </td>
      </tr>

      <tr>
        <td rowspan="2">6</td>
        <td rowspan="2" colspan="2">剪刀撑与横向斜撑</td>
        <td rowspan="1" colspan="2">剪刀撑</td>
        <td>从底部边角从下到上连接设置，角度45o〜60o间，宽度不小于4跨，且不小于6m</td>
        <td>0</td>
        <td>
          <!--<van-field v-model="form.JDCYS" placeholder="" />-->
          <van-radio-group v-model="form.JDCYS">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
        </td>
      </tr>
      <tr>
        <td rowspan="1" colspan="2">横向斜撑</td>
        <td>开口型脚手架时两端应按之字型设置</td>
        <td>—</td>
        <td>
          <!--<van-field v-model="form.HXXCYS" placeholder="" />-->
          <van-radio-group v-model="form.HXXCYS">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
        </td>
      </tr>
      <tr>
        <td rowspan="3">7</td>
        <td rowspan="3" colspan="2">杆件间距</td>
        <td rowspan="1" colspan="2">步距</td>
        <td rowspan="3">第4.3.1条</td>
        <td>±20</td>
        <td>
          <!--<van-field v-model="form.BJ" placeholder="" />-->
          <van-radio-group v-model="form.BJ">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
        </td>
      </tr>
      <tr>
        <td>纵距</td>
        <td></td>
        <td>±50</td>
        <td>
          <!--<van-field v-model="form.ZJ" placeholder="" />-->
          <van-radio-group v-model="form.ZJ">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
        </td>
      </tr>
      <tr>
        <td>横距</td>
        <td></td>
        <td>±20</td>
        <td>
          <!--<van-field v-model="form.HJ" placeholder="" />-->
          <van-radio-group v-model="form.HJ">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
        </td>
      </tr>

      <tr>
        <td rowspan="1">8</td>
        <td rowspan="1" colspan="2">脚手板</td>
        <td rowspan="1" colspan="2">—</td>
        <td>牢固、无活动板、无悬挑板</td>
        <td>—</td>
        <td>
          <!--<van-field v-model="form.JSB" placeholder="" />-->
          <van-radio-group v-model="form.JSB">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
        </td>
      </tr>
      <tr>
        <td rowspan="1">9</td>
        <td rowspan="1" colspan="2">架体层间防护</td>
        <td rowspan="1" colspan="2">—</td>
        <td>首层及顶层、其他每隔3步应与建筑物间水平封闭隔离</td>
        <td>—</td>
        <td>
          <!--<van-field v-model="form.JTCJFH" placeholder="" />-->
          <van-radio-group v-model="form.JTCJFH">
            <van-radio name="1">合格</van-radio>
            <van-radio name="0">不合格</van-radio>
          </van-radio-group>
        </td>
      </tr>

      <tr>
        <td style="text-align: left; padding: 10px" colspan="5">施工单位（工匠）检查结果</td>
        <td colspan="4" style="text-align: left">
          <p>
            <!-- 检查人员 -->
            <!-- <van-field name="检查人员" placeholder="请填写检查人员" label="检查人员" v-model="form.YSRY" /> -->
            <qianzi :placeholder="'请填写检查人员'" :file="fileshouxie" :GROUPGUID="`扣件式钢管脚手架检查验收表_${number}_施工单位检查人员`" :ROW_GUID="rowData.ROW_GUID"></qianzi>
          </p>
          <p>
            <!-- <van-field v-model="radioAll.YSSJ" /> -->
            <van-field
              readonly
              clickable
              name="datetimePicker"
              :value="form.YSSJ"
              label="检查时间："
              placeholder="请选择检查时间"
              @click="showPickerq = true"
            />
            <van-popup v-model="showPickerq" position="bottom">
              <van-datetime-picker v-model="currentDate" type="date" title="选择年月日" @cancel="showPickerq = false" @confirm="onConfirmRQ" />
            </van-popup>
          </p>
          <!-- <span style="float: left; margin-left: 32px">检查人员：<van-field v-model="form.YSRY" placeholder="" /></span>
          <br />
          <br />
          <span style="float: right; margin-right: 32px"><van-field v-model="form.YSSJ" placeholder="年" /></span>-->
        </td>
      </tr>
      <tr>
        <td style="text-align: left; padding: 10px" colspan="5">业主（监理）验收结论</td>
        <td colspan="4" style="text-align: left">
          <!-- <span style="float: left; margin-left: 32px">检查人员：<van-field v-model="form.YZYSRY" placeholder="" /></span>
          <br />
          <br />
          <span style="float: right; margin-right: 32px">-->
          <!-- <van-field
  v-model="form.YZYSSJ"
  is-link
  readonly
  name="datetimePicker"
  label="时间选择"
  placeholder="点击选择时间"
  @click="showPicker = true"
          /></span>-->
          <p>
            <!-- 检查人员 -->
            <!-- <van-field name="检查人员" placeholder="请填写检查人员" label="检查人员" v-model="form.YZYSRY" /> -->
            <qianzi :placeholder="'请填写检查人员'" :file="fileshouxie1" :GROUPGUID="`扣件式钢管脚手架检查验收表_${number}_业主检查人员`" :ROW_GUID="rowData.ROW_GUID"></qianzi>
          </p>
          <p>
            <!-- <van-field v-model="radioAll.YZYSSJ" /> -->
            <van-field
              readonly
              clickable
              name="datetimePicker"
              :value="form.YZYSSJ"
              label="检查时间："
              placeholder="请选择检查时间"
              @click="showPicker = true"
            />
            <van-popup v-model="showPicker" position="bottom">
              <van-datetime-picker v-model="currentDate1" type="date" title="选择年月日" @cancel="showPicker = false" @confirm="onConfirmR" />
            </van-popup>
          </p>
        </td>
      </tr>
      <tr>
        <td style="text-align: left; padding: 10px" colspan="8">
          <p>附件：</p>
          <p @click="seeFile" style="color: blue;">《农民自建低层住宅结构施工及验收规程》和条文说明</p>
        </td>
      </tr>
    </table>
    <div class="footer" v-if="!$route.query.type">
      <!-- <van-button
        style="margin-right: 10px"
        size="small"
        type="info"
        @click="handleClick(SaveData)"
        >提交</van-button
      >-->
      <van-button v-if="!this.$store.state.isGJ ||rowData.OPTYPE == '60' " size="small" type="info" @click="save">保存</van-button>
    </div>
  </div>
</template>
<style lang="scss">
#GGJSJ {
  height: 100vh;
  overflow: auto;
  .van-radio__label {
    width: 48px;
  }
  /*padding:  10px;*/
  table,
  table tr th,
  table tr td {
    border: 1px solid #000000;
    text-align: center;
  }
  .footer {
    text-align: center;
    padding: 10px 0;
  }
}
</style>
<script>
import { updateDataView, dataServerOpenDataView, insertDataView, FileServerProxy } from '../../../utils/api'
import qianzi from '../../../common/qianzi.vue'
import dd from 'gdt-jsapi'
export default {
  data() {
    return {
      radio: '',
      form: {
        row_guid: '',
        to_row_guid: '',
        GGYS: '1',
        KJYS: '1',
        GGWQYS1: '1',
        GGWQYS2: '1',
        GGWQYS3: '1',
        BMYS: '1',
        PSYS: '1',
        DBYS: '1',
        LGYS: '1',
        ZXSPGYS: '1',
        HXSPGYS: '1',
        GJJDCYS: '1',
        JTWZYS: '1',
        NJNLJYS: '1',
        SZJJYS: '1',
        LZJDJLYS: '1',
        JZWLJYS: '1',
        SDGYS: '1',
        JDCYS: '1',
        HXXCYS: '1',
        BJ: '1',
        ZJ: '1',
        HJ: '1',
        JSB: '1',
        JTCJFH: '1',
        YSJL: '1',
        YSRY: '',
        YSSJ: '',
        YZYSRY: '',
        YZYSSJ: ''
      },
      fileshouxie: [
        {
          title: '请填写检查人员',
          FileName: '无',
          groupGuid: `扣件式钢管脚手架检查验收表_${this.number}_施工单位检查人员`,
          fileList: [],
        },
      ],
      fileshouxie1: [
        {
          title: '请填写检查人员',
          FileName: '无',
          groupGuid: `扣件式钢管脚手架检查验收表_${this.number}_业主检查人员`,
          fileList: [],
        },
      ],
      isDataList: false,
      currentDate: new Date(),
      currentDate1: new Date(),
      showPickerq: false,
      showPicker: false,
      number: '',
      rowData:{}
    }
  },
  methods: {
    seeFile() {
      dd.ready(function () {
        dd.openLink({
          url: 'https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/ZLJ/文明.pdf'
        })
          .then(res => {
          })
          .catch(err => {
            console.error(err)
          })
      })
    },
    defaultField() {
      let dateTime
      let yy = new Date().getFullYear()
      let mm = new Date().getMonth() + 1 < 10 ? '0' + (new Date().getMonth() + 1) : new Date().getMonth() + 1
      let dd = new Date().getDate() < 10 ? '0' + new Date().getDate() : new Date().getDate()
      dateTime = yy + '-' + mm + '-' + dd
      this.form.YSSJ = dateTime
      this.form.YZYSSJ = dateTime
    },
    //获取数据
    getData: async function () {
      // let dataGuid = "db395dad-b33f-4b51-971e-dd4f5572baf7";
      // let searchObject = encodeURIComponent(
      //   JSON.stringify([
      //     { field: "to_row_guid", value: this.rowData.ROW_GUID, operator: "=" },
      //   ])
      // );
      // let token = window.localStorage.getItem("token");
      // const res = await dataServerOpenDataView(dataGuid, searchObject, token);
      // if (res.data.Data && res.data.Data.length == 0) {
      //   //新增
      //   this.isDataList = false;
      // } else {
      //   //修该
      //   this.form = res.data.Data[0];
      //   this.isDataList = true;
      // }
      let params = {
        accessCode: '688bd3883572440a859dfd8ba9194e7b',
        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: {
          dataguid: 'db395dad-b33f-4b51-971e-dd4f5572baf7',
          searchObject: JSON.stringify([{ field: 'to_row_guid', value: this.rowData.ROW_GUID, operator: '=' },{ field: 'CS', value: this.number, operator: '=' }]),
          token: window.localStorage.getItem('token')
        }
      }
      const res = await FileServerProxy(params)
      let data = JSON.parse(res.data.data).Data
      if (data && data.length == 0) {
        //新增
        this.isDataList = false
      } else {
        //修该
        this.form = data[0]
        this.isDataList = true
      }
    },
    save: async function () {
      let data = this.form
      data.ROW_GUID = this.rowData.ROW_GUID
      data.to_row_guid = this.rowData.ROW_GUID
      data.CS=this.number;
      // let params = {
      //   dataGuid: "db395dad-b33f-4b51-971e-dd4f5572baf7",
      //   strParams: JSON.stringify([data]),
      //   token: window.localStorage.getItem("token"),
      // };
      // if (!this.isDataList) {
      //   const res = await insertDataView(params);
      //   if (res.data.Success) {
      //     this.$toast.success('保存成功!');
      //   }
      // } else {
      //   const res = await updateDataView(params);
      //   if (res.data.Success) {
      //     this.$toast.success('保存成功!');
      //   }
      // }
      let params = {
        accessCode: '',
        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: {
          dataGuid: 'db395dad-b33f-4b51-971e-dd4f5572baf7',
          strParams: JSON.stringify([data]),
          token: window.localStorage.getItem('token')
        }
      }
      if (!this.isDataList) {
        params.accessCode = '0fb3f6123d1b4fe6851c99532c463f6f'
        const res = await FileServerProxy(params)
        let data = JSON.parse(res.data.data).Success
        if (data) {
          this.$toast.success('成功！')
        }
      } else {
        params.accessCode = '77ad6c1591e54d4fbc45ecc90374a2a2'
        const res = await FileServerProxy(params)
        let data = JSON.parse(res.data.data).Success
        if (data) {
          this.$toast.success('修改成功!')
        }
      }
    },
    onConfirmR(val) {
      let year = val.getFullYear()
      let month = val.getMonth() + 1
      let day = val.getDate()
      let hour = val.getHours()
      let minute = val.getMinutes()
      if (month >= 1 && month <= 9) {
        month = `0${month}`
      }
      if (day >= 1 && day <= 9) {
        day = `0${day}`
      }
      if (hour >= 0 && hour <= 9) {
        hour = `0${hour}`
      }
      if (minute >= 0 && minute <= 9) {
        minute = `0${minute}`
      }
      this.form.YZYSSJ = `${year}-${month}-${day}`
      this.showPicker = false
    },
    onConfirmRQ(val) {
      let year = val.getFullYear()
      let month = val.getMonth() + 1
      let day = val.getDate()
      let hour = val.getHours()
      let minute = val.getMinutes()
      if (month >= 1 && month <= 9) {
        month = `0${month}`
      }
      if (day >= 1 && day <= 9) {
        day = `0${day}`
      }
      if (hour >= 0 && hour <= 9) {
        hour = `0${hour}`
      }
      if (minute >= 0 && minute <= 9) {
        minute = `0${minute}`
      }
      this.form.YSSJ = `${year}-${month}-${day}`
      this.showPickerq = false
    }
  },
  components:{
    qianzi
  },
  mounted() {
    this.defaultField()
    this.number = this.$route.query.number
    this.rowData = JSON.parse(this.$route.query.data)
    this.SaveData = JSON.parse(this.$route.query.data1)
    this.getData()
    // this.showEdition = this.$store.state.Edition;
  }
}
</script>
